
<template>
    <scroll-view class="scroll-view" scroll-y 
    @scrolltolower="onscrolltolower"
    >
      <Pageskeleton v-if="skeletonflag"></Pageskeleton>
      <view v-else class="guess">
      <navigator
        class="guess-item"
        v-for="item in guessList"
        :key="item.id"
        :url="`/pages/detail/detail?id=${item.id}`"
      >
        <view style="position: relative;">
          <image class="image" mode="aspectFill"  src="/static/show.png" style="position: absolute;z-index: 999;"></image>
          <image class="image" mode="aspectFill" :src="item.default_image_url"></image>
        </view>
        <view class="matron_text">
          <view class="text_grip" style="width: 70%;">
            <view class="matron_name">{{ item.name }}</view>
            <view v-if="item.serve_type" class="matron_label" style="background-color: #d19fe9; font-size: 10px;">服务中</view>
            <view v-else class="matron_label">休息</view>
          </view>
          <view class="text_grip" style="justify-content: flex-end; width: 30%;">
<view class="matron_price">￥{{ item.price }}</view>
          </view>
          <view class="text_grip">
            <view class="matron_department">{{ item.department }}</view>
        </view>
        <view class="text_grip"  style="justify-content: flex-end;">
          <view class="matron_button">预定</view>
      </view>
      </view>

      </navigator>
    </view>
 
    <view class="loading-text">
      {{ pageParam.page_num >= pageParam.page_count ? '没有更多数据~' : '正在加载...' }}
    </view>
    </scroll-view>
  </template>
<script setup lang="ts">
  import {ref} from 'vue'
  import Pageskeleton from './matronSkeleton.vue'
  const Props = defineProps(['guessList','skeletonflag'])
  const onscrolltolower = ()=>{
      if(pageParam.value.page_num < pageParam.value.page_count){
        pageParam.value.page_num++
        uni.request({
    url: 'list/'+query.id+'/',
   
    data:pageParam.value,
    header: {
      Accept: 'application/json',
      'Content-Type': 'application/json',
      'X-Requested-With': 'XMLHttpRequest'
    },
    method: 'POST',
    sslVerify: true,
    success: ({ data, statusCode, header }) => {
      guessList.value.push(...data.list)
      pageParam.value.page_count=data.count
      skeletonflag.value = false
      scrollflag.value = false
    },
    fail: (error) => {}
  })
 
  
      }
      else{
        
      }
  }
 
const change=( )=>{
  uni.navigateBack({
    delta:1
  })
  
}

  import { onMounted, ref } from 'vue'
  const { safeAreaInsets } = uni.getSystemInfoSync()

  const pageParam=ref({
    page_num:1,
    page_size:8,
    page_count:0
  })


  </script>
  




<style lang="scss">
:host {
display: block;
}
/* 分类标题 */
.matron_text{
display: flex;
flex-wrap: wrap;
margin: 4px;
margin-top: 0px;
margin-left: 6px;
margin-right: 6px;
.text_grip{
  display: flex;
  width: 50%;
  align-items: center;
  font-size: 14px;
  margin-bottom: 5px;
  .matron_name{
    margin-right: 3px;
  }
  .matron_price{
    color: #e14848;
    margin-right: 1px;
  }
  .matron_department{

  }
  .matron_button{
    height:20px;
    width: 50px;
    font-size: 12px;
    line-height: 20px;
    text-align: center;
    color: #fff;
    border-radius: 3px;
    background-color: #24edc2;

  }
  .matron_label{
    height: 15px;
    width: 35px;
    margin: 5px;
    font-size: 10px;
    line-height: 15px;
    text-align: center;
    border-radius: 10%;
    margin: 2px;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.3);
  }
}
}
.caption {
display: flex;
position: relative;
justify-content: center;
align-items: center;
line-height: 1;
padding: 36rpx 20rpx 40rpx;
font-size: 35rpx;
color: #fff;
background-color: #24edc2;

.text {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-top:7%;
  &::before,
  &::after {
    content: '';
    width: 20rpx;
    height: 20rpx;
    background-image: url(@/static/images/bubble.png);
    background-size: contain;
    margin: 0 10rpx;
  }
}
.bt{
  
  position: absolute;
  left: 10px;
  transform: translateY(10px);
  
}
}

/* 猜你喜欢 */
.guess {
width: 100%;
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.guess-item {
  width: 354rpx;
  margin: 5px;
  border-radius: 8rpx;
  overflow: hidden;
  background-color: #fff;
}
.image {
  width: 100%;
  height: 354rpx; 
}
.name {
  height: 35rpx;
  margin: 10rpx 0;
  margin-right: 20px;
  font-size: 26rpx;
  color: #262626;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.price {
  line-height: 1;
  padding-top: 4rpx;
  color: #cf4444;
  font-size: 26rpx;
}
.small {
  font-size: 80%;
}
}
.guess::after{
  content: ' ';
  width: 334rpx;
  flex-grow: 1;
}
// 加载提示文字
.loading-text {
text-align: center;
font-size: 28rpx;
color: #666;
padding: 20rpx 0;
}
page {
height: 100%;
display: flex;
flex-direction: column;
background-color: rgba(0, 0, 0, 0.03);
}
.scroll-view {
flex: 1;
height: 100%;
}
</style>